package com.supercell.entity;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.Set;

/**
 * Created by WUJO2 on 7/15/2016.
 */
@Entity
@Table
public class Department extends GenericEntity {
    public static final String SALARY = "salary";
    public static final String DEPARTMENT_NAME = "departmentName";
    public static final String CITY = "city";

    public static final String CLIENT_SIDE_DUMMY_DEPARTMENT_NAME = "dName";

    @OneToMany(mappedBy = "department")
    @Cascade(value = {CascadeType.DELETE, CascadeType.REMOVE})
    Set<Person> personSet;

    @Column(nullable = false)
    private String departmentName;

    @Column(nullable = false)
    private String city;

    public Department() {
    }

    public Department(String departmentName) {
        this.departmentName = departmentName;
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public Set<Person> getPersonSet() {
        return personSet;
    }

    public void setPersonSet(Set<Person> personSet) {
        this.personSet = personSet;
    }
}
